<template>
	<!-- 中医数据 -->
	<view class="chineseMedicineDateBase">
		<!-- banner -->
		<u-swiper :list="banner" circular class="u-m-t-20 u-m-b-20" height="320" mode="none"></u-swiper>
		
		<view class="list">
			<view v-for="(item,index) in list" :key='index' @click="listItem(item)">
				<image class="thumb" :src="vuex_httpImageUrl && vuex_httpImageUrl+'static/zhongyi/thumb.png'" mode="widthFix"></image>
				<view>
					<view class="title">{{item.name}}</view>
					<view>
						<text>报告时间：{{item.crtime}}</text>
						<text>采集时间：{{item.cotime}}</text>
					</view>
				</view>
			</view>
		</view>
		
		<image class="flex" v-if="vuex_httpImageUrl" :src="vuex_httpImageUrl+'static/zhongyi/flex.png'" mode="widthFix" @click="flex"></image>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				banner:[],
				list:[]
			};
		},
		onShow() {
			this.def_data()
		},
		methods:{
			def_data(){
				this.$u.post('/index/zybanner').then(res=>{
					console.log(res.data);
					this.banner = res.data
				})
				
				this.$u.post('/appuser/use_collect').then(res=>{
					this.list = res.data
				})
				
				// let url = this.vuex_httpImageUrl ;
				// this.list = [
				// 	{
				// 		thumb:url+'static/zhongyi/thumb.png',
				// 		title:'这里是名称',
				// 		bg:'2020-12-12',cj:'2020-12-12',
				// 	}
				// ]
			},
			listItem(item){
				uni.navigateTo({
					url:'./detail/detail?db='+encodeURIComponent(JSON.stringify(item))
				})
			},
			flex(){
				uni.navigateTo({
					url:"./collection/collection"
				})
			}
		}
	}
</script>

<style lang="scss">
	.chineseMedicineDateBase{
		.list{
			width: 95%;
			margin: 30rpx auto;
			>view{
				background-color: #FFFFFF;
				border-radius: 20rpx;
				padding: 30rpx; 
				display: flex;
				align-items: center;
				.thumb{
					margin-right: 20rpx;
					width: 80rpx;
					height: 80rpx;
				}
				>view{
					flex: 1;
				}
				.title{
					font-weight: bold;
				}
				.title+view{
					font-size: 24rpx;
					display: flex;
					align-items: center;
					justify-content: space-between;
					color: rgba(0,0,0,.5);
				}
				
			}
		}
	
		.flex{
			width: 120rpx;
			height: 120rpx;
			position: fixed;
			bottom: 20%;
			right: 20rpx;
		}
	}
</style>
